package com.flying.inherit.inheritanceTest4;

/**
 * @ClassName: Test4
 * @createDate: 2023/6/27 20:35
 * @author: liu
 * @description:练习4_重写get方法
 */
public class Test4 {
    public static void main(String[] args) {
        Father f=new Father();
        Son s=new Son();

        System.out.println(s.getInfo());  //  大硅谷

        s.setInfo("尚硅谷");
        s.test();   //  尚硅谷
        System.out.println(s.getInfo());   // 大硅谷


    }
}

class Father{
    private String info="atguigu";
    public void setInfo(String info){
        this.info=info;
    }
    public String getInfo(){
        return info;
    }
}

class Son extends Father {
    private String info="大硅谷";

    @Override
    public String getInfo() {
        return  info;
    }

    public void test(){
        System.out.println(super.getInfo());
    }
}
